package com.atguigu.lease.common.utils;

import java.util.Random;

public class CodeUtil {

    /**
     * 获取到length位的随机短信
     * @param length
     * @return
     */
    public static String getCode(Integer length){
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (Integer integer = 0; integer < length; integer++) {
            int i = random.nextInt(10);
            sb.append(i);
        }
        String code = sb.toString();
        return code;
    }
}
